package socketmvc.core.packets.biz;

public enum ChatType {

    /**
     * <pre>
     *未知
     * </pre>
     *
     * <code>CHAT_TYPE_UNKNOWN = 0;</code>
     */
    CHAT_TYPE_UNKNOWN(0),
    /**
     * <pre>
     *公聊
     * </pre>
     *
     * <code>CHAT_TYPE_PUBLIC = 1;</code>
     */
    CHAT_TYPE_PUBLIC(1),
    /**
     * <pre>
     *私聊
     * </pre>
     *
     * <code>CHAT_TYPE_PRIVATE = 2;</code>
     */
    CHAT_TYPE_PRIVATE(2),
    ;

    public final int getNumber() {
        return value;
    }

    public static ChatType valueOf(int value) {
        return forNumber(value);
    }

    public static ChatType forNumber(int value) {
        return switch (value) {
            case 0 -> CHAT_TYPE_UNKNOWN;
            case 1 -> CHAT_TYPE_PUBLIC;
            case 2 -> CHAT_TYPE_PRIVATE;
            default -> null;
        };
    }

    private final int value;

    ChatType(int value) {
        this.value = value;
    }

}
